<!--js date picker-->

<link href="<?php echo base_url(); ?>./css/css_datepicker/jquery.ui.all.css" rel="stylesheet" type="text/css" />  
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery-1.7.2.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.core.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="<?php echo base_url(); ?>jscripts/js_datepicker/jquery.ui.widget.js"></script>

<!--end js date picker-->

<!--start of datepicker-->

<script language="javascript" type="text/javascript">
    $(function() {
        $( ".datepicker" ).datepicker({
            changeMonth: true,
            changeYear: true,
            dateFormat: 'yy:mm:dd' 
        });
    });
           
</script>

<!--the end of datepicker-->

<style type="text/css">
    span{color:red;}
</style>

<div style="margin: 0 auto;width: 98%;height: auto;border: 0px #ccc solid;text-align: center;font-size: 20px;color:#4F815C;">Sale Material</div><br/>
<div style="margin: 0 auto;width:93%;height: auto;border: 1px #ccc solid; padding:20px 15px 20px 15px;-moz-border-radius:10px;">
    <div style="float: right; border: 0px #ccc solid;"><?php echo anchor('sale_management/manager', img('images/user_images/cancel.png')); ?></div>
    <?php echo form_open('sale_management/add_material', array('name' => 'frmstudent', 'onsubmit' => 'return check_student()')); ?>
    <?php
    echo '<table border="0" align="center" style="font-weight: lighter;font-size: 14px;">';

    //===========this is condition for showing form validation==============//

    if ($this->session->userdata('ms_error')) {
        echo message($this->session->userdata('ms_error'), "error");
        $this->session->unset_userdata("ms_error");
    } else if ($this->session->userdata('invalid_sal')) {
        echo $this->session->userdata('invalid_sal');
        echo $this->session->unset_userdata('invalid_sal');
    }

    //==========this is condition for the end of form validation============//

    echo '<tr>';
    //$this->db->select('*');
    $selectdata = $this->db->get('tbl_student');
    $select[' '] = '--Select student--';
    foreach ($selectdata->result() as $row) {
        $select[$row->stu_id] = $row->stu_name;
    }
    echo '<td>CustomerName<span>*</span></td>';
    echo '<td>';
    echo form_dropdown("customer_name", $select, $this->input->post("customer_name") ? $this->input->post("customer_name") : " ");
    echo '</td>';
    echo '</tr>';
    /* =======================end add customer name=============== */
    echo '<tr>';
    //$this->db->select('*');
    $selectda = $this->db->get('tbl_product');
    $select1[' '] = '--Please Select--';
    foreach ($selectda->result() as $rows) {
        $select1[$rows->pro_id] = $rows->pro_name;
    }
    echo '<td>ProductName<span>*</span></td>';
    echo '<td>';
    echo form_dropdown("txt_proname", $select1, $this->input->post("txt_proname") ? $this->input->post("txt_proname") : " ");
    echo '</td>';
    echo '</tr>';
    /* =======================end add product name=============== */
    echo '<tr>';
    echo '<td>SaleQuantity<span>*</span></td>';
    echo '<td>' . form_input(array('name' => 'txt_quantity', 'value' => $this->input->post('txt_quantity') ? $this->input->post('txt_quantity') : " ")) . form_error('txt_quantity') . '</td>';
    echo '</tr>';
    ?>
    <tr>
        <td valign='top'>SaleDate<span>*</span></td>
        <td><input type="text" name="txt_saleDate" class="datepicker" value="<?php echo ($this->input->post("txt_saleDate")) ? $this->input->post("txt_saleDate") : "" ?>"/><?php echo form_error('txt_saleDate'); ?></td> 

    </tr>
<?php
echo '<tr>';
$this->db->select('*');
$get_material = $this->db->get('tbl_product');
$select_price[' '] = '--Please Select--';
foreach ($get_material->result() as $value) {
    $select_price[$value->pro_price] = $value->pro_name . '&nbsp;$' . $value->pro_price;
}
echo '<td>Price<span>*</span></td>';
echo '<td>';
echo form_dropdown("txt_price", $select_price, $this->input->post("txt_price") ? $this->input->post("txt_price") : " ");
echo '</td>';
echo '</tr>';
/* =======================end add product name=============== */
echo '<tr>';
echo '<td>Descripton</td>';
echo '<td> ' . form_textarea(array('name' => 'txt_desc', 'rows' => '8', 'cols' => '50', 'value' => $this->input->post('txt_desc') ? $this->input->post('txt_desc') : " ")) . form_error('txt_desc') . '</td>';
echo'</tr>';

echo '<tr>';
echo '<td></td>';
echo '<td>' . form_input(array('name' => 'btn_submit', 'type' => 'submit', 'value' => 'Submit')) . form_input(array('type' => 'reset', 'value' => 'Reset')) . '</td>';
//echo '<td>'.anchor(array('type'=>'button','students/manager'=>'Cansel')).'</td>';
echo '</tr>';
echo '</table>';
?>
    <?php echo form_close(); ?>
</div>